#include("/manage/_common/_layout.html")
#@layout()

### ********************************* 定义页面标题
#define title()
新闻列表
#end

### ********************************* css导入
#define import_css()
<style>
.layui-table-cell img{max-width:50px; height:28px}
</style>
#end

### ********************************* js导入
#define import_js()
#end

### ********************************* Body内容区开始
#define main()
<div class="layui-form layui-card-header" style="height: auto;">
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">标题</label>
			<div class="layui-input-inline">
				<input id="title" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">新闻分类</label>
			<div class="layui-input-inline">
				<select id="categoryId" name="categoryId">
					<option value="">-- 请选择 --</option>
					#for(newsCategory : newsCategoryList)
					<option value="#(newsCategory.id)">#(newsCategory.name)</option>
					#end
				</select>
			</div>
		</div>

		<div class="layui-inline">
			<label class="layui-form-label">状态</label>
			<div class="layui-input-inline">
				<select id="status" name="status">
					<option value="">-- 请选择 --</option>
					<option value="on">启用</option>
					<option value="off">禁用</option>
				</select>
			</div>
		</div>

		<div class="layui-inline">
			<a class="layui-btn" lay-submit="" id="ID_btn_search">
				<i class="layui-icon layui-icon-search"></i>
			</a>
		</div>
	</div>
</div>

<table class="layui-table"
	lay-data="{height: 'full-100', cellMinWidth: 60,url:'#(ctx)/manage/news/ajaxSearch', page:true, initSort: {field:'onTop', type:'desc'}, id:'ID_master_table', toolbar: '#ID_master_table_toolbar'}"
	lay-filter="LAY-master-table">
	<thead>
		<tr>
			<th lay-data="{field:'id', width:60, align:'center', sort: true, fixed: true}">ID</th>
			<th lay-data="{width:75, sort: true, align:'center', templet:'#statusTpl', fixed: true}">状态</th>
			<th lay-data="{field:'title', width:260, sort: true, fixed: true}">标题</th>
			<th lay-data="{width:80, align:'center', templet:'#reviewImgTpl'}">图片</th>
			<th lay-data="{field:'categoryName', width:160, sort: true}">新闻分类</th>
			<th lay-data="{field:'subtitle', width:300, sort: true}">子标题</th>
			<th lay-data="{field:'onTop', width:75, align:'center', templet:'#onTopTpl'}">置顶</th>
			<th lay-data="{field:'hits', width:80, sort: true}">点击数</th>
			<th lay-data="{width:160, sort: true, templet:'#editorTpl'}">编辑人</th>
			<th lay-data="{field:'editedTime', width:160, align:'center', sort: true}">编辑日期</th>
			<th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#LAY-master-table-action'}">操作</th>
		</tr>
	</thead>
</table>

<!-- 数据表格头部工具栏 -->
<script type="text/html" id="ID_master_table_toolbar">
	<div class="layui-btn-container">
		<a class="layui-btn layui-btn-sm" lay-event="add" id="ID_btn_add"><i class="layui-icon layui-icon-add-circle"></i> 添加</a>
	</div>
</script>

<!-- 行操作栏 -->
<script type="text/html" id="LAY-master-table-action" >
	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>

<!-- 数据表格单元格模板区域 -->
<script type="text/html" id="statusTpl">
#[[
	{{# if(d.status === 'off'){ }}
		<span style="color: #F581B1;">禁用</span>
	{{# } else { }}
		启用
	{{# } }}
]]#
</script>

<script type="text/html" id="reviewImgTpl">
#[[
	{{# if(d.img != '' && d.img != null){ }}
		<img onclick="Jfsa.reviewImage(this);" src="{{ d.img }}">
	{{#  } }}
]]#
</script>

<script type="text/html" id="onTopTpl">
#[[
	{{# if(d.onTop){ }}
		<span style="color: #F581B1;">置顶</span>
	{{#  } }}
]]#
</script>

<script type="text/html" id="editorTpl"> ### 编辑人单元格模板区域
#adminList()
	#for(admin : adminList)
#[[ {{# if(d.editorId === ]]# #(admin.id) #[[ ){ }} ]]#
		#(admin.name)
#[[	{{# } }} ]]#
	#end
#end
</script>
#end
### ********************************* Body内容区结束


### ********************************* 脚本区开始
#define script()
#include("_index_script.html")
#end
### ********************************* JS脚本区结束
